import { View, Text, StyleSheet, Pressable } from 'react-native'
import React, { useState } from 'react'
import UIConstants from '../constants/UIConstants'

export default function ZhButton({ onPress, title, bgColo = UIConstants.COLOR_GREEN }) {
  let [color, setColor] = useState(bgColo)
  return (
    <Pressable onPress={onPress} onPressIn={()=>setColor('#060')} onPressOut={()=>setColor(bgColo)} >
      <View  style={[ss.btn, { backgroundColor: color }]}>
        <Text style={ss.txt}>{title}</Text>
      </View>
    </Pressable>
    
  )
}

let ss = StyleSheet.create({
  btn: {
    backgroundColor: UIConstants.COLOR_GREEN,
    borderRadius: UIConstants.BORDER_RADIUS_MD,
    paddingVertical: UIConstants.SPACE_COL_MD,
  },
  txt: {
    color: UIConstants.COLOR_WHITE,
    textAlign: 'center',
    fontSize: 16,
  }
})